from SimpleXMLRPCServer import SimpleXMLRPCServer 
from xmlrpclib import *

HOST = '10.0.0.2'
PORT = 9000

def texer(markup):
    from pyx import canvas, text
    text.set(mode='latex', docclass='article',
    docopt='11pt')
    c = canvas.canvas()
    c.text(0, 0, markup)
    c.writePDFfile('markup.pdf', bboxenlarge=0)
    f = open('markup.pdf', 'rb')
    result = f.read()
    f.close()
    return Binary(result)

server = SimpleXMLRPCServer((HOST, PORT))
server.register_function(texer)
server.serve_forever(  )
